import withSession from './../../../lib/session'

async function handler(req, res) {
    // 账号密码登录获取用户信息
    let userInfo = {
        id: 110,
        admin: true,
        username: req.body.username,
    }
    req.session.set('userInfo', userInfo)
    await req.session.save()    // 保存
    console.log('-----------新用户登录-----------')
    console.log(req.session.get('userInfo'))
    res.status(200).json(userInfo)  // 返回客户端
}

export default withSession(handler)